package com.todo.event.activity.application.handler.fieldtransfer;

import com.todo.common.utils.StringUtils;
import com.todo.event.activity.application.entity.context.FieldTransferContext;
import com.todo.event.activity.common.enums.EventFieldDataSourceEnum;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @author azhebuxing
 * @date 2025/1/9 19:38
 * @description 静态数据就是返回transfer数据本身
 */
@Slf4j
@Component
public class StaticPropertyHandler extends AbstractFieldTransferHandle {
    @Override
    protected String doTransfer(FieldTransferContext context) {
        return context.getTransfer();
    }

    @Override
    protected Boolean doMatch(FieldTransferContext context) {
        if (!context.getDataSource().equals(getHandleType()) || StringUtils.isBlank(context.getTransfer())) {
            return false;
        }
        return true;
    }

    @Override
    protected EventFieldDataSourceEnum getHandleType() {
        return EventFieldDataSourceEnum.STATIC_PROPERTY;
    }
}
